﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using BBECServiceBusAdapter_CodeGenLib.AddForms.Designation;

namespace BBECServiceBusAdapter.Helper_Activities.Inbound
{
 
    public sealed class ProcessDesignation : CodeActivity
    {
        // Define an activity input argument of type string
        public InArgument<DesignationDataContract> DesignationData { get; set; }
        //public InArgument<Guid> DesignationLevel1 { get; set; }
        //public InArgument<Guid> DesignationLevel2 { get; set; }
        //public InArgument<Guid> DesignationLevel3 { get; set; }
        //public InArgument<Guid> DesignationLevel4 { get; set; }
        //public InArgument<Guid> DesignationLevel5 { get; set; }
        //public InArgument<Guid> DesignationReport1Code { get; set; }
        //public InArgument<Guid> DesignationReport2Code { get; set; }

        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void Execute(CodeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            //string text = context.GetValue(this.Data.).ToString;
            DesignationDataContract theDesignationData = context.GetValue(this.DesignationData);

            FundraisingPurposeAddDataFormCustomData frmData = new FundraisingPurposeAddDataFormCustomData();
            //frmData.ContextRecordID = theDesignationData
            frmData.Description = theDesignationData.Description;
            frmData.EndDate= theDesignationData.EndDate;
            frmData.FundraisingTeam = theDesignationData.FundraisingTeam;
            frmData.Goal = theDesignationData.Goal;
            //frmData.IsActive = theDesignationData.Status;
            //frmData.IsRevenueDesignation = theDesignationData.IsRevenueDesignation;
            frmData.ItemCategorySegment2 = theDesignationData.ItemCategorySegment2;
            frmData.LookupID = theDesignationData.ID;
            frmData.Priority = theDesignationData.Priority;
            frmData.ReceivedAmount = theDesignationData.ReceivedAmount;
            //frmData.RecordID
            frmData.StartDate = theDesignationData.StartDate;
            frmData.SubReg1 = theDesignationData.SubReg1;
         


            frmData.Save(new Blackbaud.AppFx.WebAPI.AppFxWebServiceProvider(Blackbaud.AppFx.Workflow.CatalogActivities.WebApiUtility.GetAppFxWebApiProvider(context).ConnectionString));
        }
    }
}
